﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Visio.ForwardEngineer.DataModel
{
    /// <summary>
    /// Structure of an index
    /// </summary>
    public class IndexStructure
    {
        public string Name;                     // Name of the index
        public bool isPrimaryKey = false;       // Is it the primary key of the table?
        public bool isUnique = false;           // Is the index UNIQUE?
        public bool isClustered = false;        // Is the index CLUSTERED?
        public ColumnList Columns;              // List of the indexed columns

        /// <summary>
        /// Standard constructor for an index
        /// </summary>
        public IndexStructure()
        {
            Columns = new ColumnList();
        }
    }

    /// <summary>
    /// Dictionary of indexes
    /// </summary>
    public class IndexList : Dictionary<string, IndexStructure>
    {
        /// <summary>
        /// Adds an index indexed by name
        /// </summary>
        /// <param name="newIndex"></param>
        public void Add(IndexStructure newIndex)
        {
            base.Add(newIndex.Name, newIndex);
        }
    }
}
